//Page Object
Page({
  data: {
    is_give:""
    
  },
  order_dtl:function(){
    wx.navigateTo({
      url: '/pages/card_voucher/record/buy',
      success: (result)=>{
        
      },
      fail: ()=>{},
      complete: ()=>{}
    });
  },
  // 立即赠送
  nowGiving:function(t){
    console.log(t.currentTarget.dataset.buy_id)
    let buyid = t.currentTarget.dataset.buy_id
    wx.navigateTo({
      url: '/pages/card_voucher/give/index?buy_id=' + buyid ,
    })
  },
  //加载刷新
  loadRefresh:function(){
    var tath = this;
    getApp().request({
      url: getApp().api.cardshop.buy_card_record,
      data: {
        is_give:tath.data.is_give
      },
      success: function (t) {
        console.log(t, '购买记录列表');
        // 购买记录  如果没有的 时间展时
        if (t.code == 1) {
          console.log(t.msg);
        } else {
          tath.setData({
            buy_card_record: t.data,
          });
        }
      },
      complete: function () { }
    });
  },

  //options(Object)
  onLoad: function(options){
    console.log(options)
    //查看卡券购买记录
    var _tath = this;
    _tath.setData({
      is_give: options.give
    })
    _tath.loadRefresh();
  },
  onReady: function(){
    
  },
  onShow: function(){
    
  },
  onHide: function(){

  },
  onUnload: function(){

  },
  onPullDownRefresh: function(){

  },
  onReachBottom: function(){

  },
  onShareAppMessage: function(){

  },
  onPageScroll: function(){

  },
  //item(index,pagePath,text)
  onTabItemTap:function(item){

  }
});